package com.it.stone_manage.controller;

import com.it.stone_manage.model.StoneAccount;
import com.it.stone_manage.service.AccountService;
import com.it.stone_manage.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;


@RestController
//解决跨域问题
@CrossOrigin

public class AccountController {
    @Autowired
    AccountService accountService;

    @PostMapping("/login")
    public Result login(@RequestBody StoneAccount stoneAccount, HttpSession session){
        return accountService.login(stoneAccount,session);
    }
    @GetMapping("logout")
    public Result logout(HttpSession session){

        return accountService.logout(session);
    }
    @PostMapping("register")
    public Result register(@RequestBody StoneAccount stoneAccount){
        return accountService.register(stoneAccount);
    }

}
